package com.easy.controller;

import com.easy.bean.Admin;
import com.easy.bean.User;
import com.easy.service.IShoppingLoginService;
import com.easy.service.ISystemLoginService;
import com.easy.util.LayData;
import com.easy.util.Page;
import com.easy.util.SYS;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpSession;
import java.util.List;

@Controller
public class SystemLoginController {
    @Autowired
    ISystemLoginService systemloginService;

    @RequestMapping("system/dologin1")
    @ResponseBody
    public LayData systemLogin(Admin admin, HttpSession session) {
        //执行登录业务
        Admin a = systemloginService.dologin(admin);
        //记录登录状态
        System.out.println(a);
        session.setAttribute(SYS.SYSTEM_LOGIN_ADMIN, a);
        return LayData.success(200, "登录成功");
    }



//    @RequestMapping("system/dologin1")
//    public String systemLogin() {
//        return "success";
//    }
}
